He mirado otros canales pero no estoy teniendo mucha suerte en obtener una respuesta a mi pregunta. Estoy trabajando en una base de código de prueba que se escribió originalmente con TestNG 5.14.10 y la he actualizado en mi archivo build.gradle a 6.8.7 (estoy usando Gradle + Maven para las dependencias). Mi archivo de compilación es el siguiente (incluye la nueva versión # para TestNG): aplicar complemento: 'java' aplicar complemento: 'idea' aplicar complemento: 'eclipse' repositorios { mavenCentral () } dependencias { compile "org.seleniumhq.selenium: selenium-java: 2.38.0" compilar "org.testng: testng: 6.8.7" testCompile ('org.uncommons: reportng: 1.1.2') { excluir grupo: 'org.testng' } testCompile "junit: junit: 4.8.2" compila "com.jayway.restassured: ten la seguridad: 1.8.1" } // inicializar la variable de conteo de subprocesos para pruebas paralelas y por defecto a 1 def threadCount = System.getProperty ("MAXTHREADS", "1") tasks.withType (Test) { maxParallelForks = 1 forkEvery = 1000 ignoreFailures = falso // Pasar todas las propiedades del sistema a las pruebas systemProperties = System.getProperties () // Hace que las transmisiones estándar (err y out) sean visibles en la consola cuando se ejecutan las pruebas testLogging.showStandardStreams = true excluir '** / tasks /' classpath + = configuraciones.testCompile } tarea firefox (tipo: Prueba) { maxParallelForks = Integer.valueOf (threadCount) // el valor predeterminado es 1 si no se especifica testLogging.events "comenzó" testLogging { eventos "iniciado", "aprobado", "omitido", "fallido", "standardOut", "standardError" exceptionFormat "completo" // el valor predeterminado es "corto" } useTestNG () { excludeGroups 'chrome', 'broken' useDefaultListeners = false oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = archivo ("$ {buildDir} / test-results / firefox") testReportDir = file ("$ {reporting.baseDir} / firefox") systemProperties.BROWSER = System.getProperty ('NAVEGADOR', 'firefox') excluir '** / selenium /' excluir '** / setupscripts /' } task chrome (tipo: Prueba) { maxParallelForks = Integer.valueOf (threadCount) // el valor predeterminado es 1 si no se especifica testLogging { eventos "iniciado", "aprobado", "omitido", "fallido", "standardOut", "standardError" exceptionFormat "completo" } useTestNG () { excludeGroups 'roto' useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = file ("$ {buildDir} / test-results / chrome") testReportDir = file ("$ {reporting.baseDir} / chrome") systemProperties.BROWSER = System.getProperty ('NAVEGADOR', 'chrome') excluir '** / selenium /' excluir '** / setupscripts /' } task internetExplorer (tipo: Prueba) { useTestNG () { excludeGroups 'chrome', 'broken' useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testReportDir = file ("$ {reporting.baseDir} / internetExplorer") testResultsDir = file ("$ {buildDir} / test-results / internetExplorer") systemProperties.BROWSER = System.getProperty ('NAVEGADOR', 'InternetExplorer') excluir '** / selenium /' excluir '** / setupscripts /' } tarea applylicense (tipo: Prueba) { useTestNG () { useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = file ("$ {buildDir} / test-results / applyLicense") testReportDir = file ("$ {reporting.baseDir} / applyLicense") scanForTestClasses = falso incluir '** / setupscripts / ApplyLicense.class' } task uatsetup (tipo: Prueba) { useTestNG () { useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = archivo ("$ {buildDir} / test-results / uatSetup") testReportDir = file ("$ {reporting.baseDir} / uatSetup") scanForTestClasses = falso incluir '** / setupscripts / UatSetup.class' } task restsetup (tipo: Prueba) { useTestNG () { useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = file ("$ {buildDir} / test-results / restSetup") testReportDir = file ("$ {reporting.baseDir} / restSetup") scanForTestClasses = falso incluir '** / setupscripts / RestSetup.class' } configuración de jabón de tareas (tipo: Prueba) { useTestNG () { useDefaultListeners = false; oyentes << 'org.uncommons.reportng.HTMLReporter' oyentes << 'org.uncommons.reportng.JUnitXMLReporter' oyentes << 'com.xmatters.testng.Listener' } testResultsDir = file ("$ {buildDir} / test-results / soapSetup") testReportDir = file ("$ {reporting.baseDir} / soapSetup") scanForTestClasses = falso incluir '** / setupscripts / SoapSetup.class' } tarea de selenio (tipo: Prueba) { testResultsDir = file ("$ {buildDir} / test-results / selenium") testReportDir =archivo ("$ {reporting.baseDir} / selenium") incluir '** / selenium /' excluir '** / webdriver /' excluir '** / * $ *', '** / Resumen *' excluir '** / messagepanel /' excluir '** / propertyylibrary /' } javadoc () { title = "API de objetos de página xMod" } contenedor de tareas (tipo: contenedor) { gradleVersion = '1.7' } Ejecuté una compilación usando los argumentos --debug y --stacktrace para una tarea (contiene dos scripts de configuración que están anotados y tratados como una prueba estándar). Parece que la prueba se está configurando para aprobar y luego reprobar. Comportamiento muy extraño. Parece que se trata de una especie de problema de compatibilidad con versiones anteriores. Por lo general, ejecuto esto en un conjunto de ~ 500 pruebas sin problemas, el único cambio ha sido mi bersión de TestNG. Aquí está mi comando de shell y la salida resultante (lo reduje a las líneas que creo que son relevantes ya que el modo de depuración es MUY detallado): ./gradlew uatsetup -DREMOTE_DRIVER = false -DWEB_SERVER = 10.3.1.226: 8888 --stacktrace --debug Tuve que usar PasteBin para mi salida de depuración debido al tamaño: http://pastebin.com/wsczwgT9 Cualquier ayuda sería genial. Salud, Darwin
2021-03-01 08:23:37
No estoy familiarizado con Gradle, pero en mi configuración de Maven normalmente veo la excepción java.lang.ClassNotFoundException cuando no hay dependencias de Maven descargadas en mi estación de trabajo (análogo de 'mvn clean'). Ejecutar 'mvn install' hace el trabajo por mí. Solo asegúrese de que las bibliotecas, JAR, etc. necesarios estén disponibles en su PC. 1 | Bueno, después de investigar un poco, encontré la respuesta a esta. Las versiones más nuevas de TestNG parecen requerir la biblioteca guice de Google. Agregué esto a mis dependencias y parece haber resuelto el problema. Lo que estaba sucediendo es que las pruebas estaban pasando, pero el informe se rompió debido a la dependencia que faltaba y marcó toda la compilación (y las pruebas) como una falla. Agregué la siguiente línea a mis declaraciones de dependencias: compilar "com.google.inject: guice: 3.0" No tengo idea de por qué no está un poco más claro que esta biblioteca es necesaria, pero supongo que es así. De todos modos, problema resuelto. | Tu respuesta StackExchange.ifUsing ("editor", function () { StackExchange.using ("editor externo", función () { StackExchange.using ("fragmentos", función () { StackExchange.snippets.init (); }); }); }, "fragmentos de código"); StackExchange.ready (function () { var channelOptions = { etiquetas: "" .split (""), id: "1" }; initTagRenderer ("". split (""), "" .split (""), channelOptions); StackExchange.using ("editor externo", función () { // Debe activar el editor después de los fragmentos, si los fragmentos están habilitados if (StackExchange.settings.snippets.snippetsEnabled) { StackExchange.using ("fragmentos", función () { createEditor (); }); } demás { createEditor (); } }); function createEditor () { StackExchange.prepareEditor ({ useStacksEditor: false, heartbeatType: 'respuesta', autoActivateHeartbeat: falso, convertImagesToLinks: verdadero, noModals: cierto, showLowRepImageUploadWarning: true, reputacionToPostImages: 10, bindNavPrevention: verdadero, sufijo: "", imageUploader: { brandingHtml: "Desarrollado por \ u003ca href = \" https: //imgur.com/ \ "\ u003e \ u003csvg class = \" svg-icon \ "width = \" 50 \ "height = \" 18 \ "viewBox = \ "0 0 50 18 \" fill = \ "none \" xmlns = \ "http: //www.w3.org/2000/svg \" \ u003e \ u003cpath d = \ "M46.1709 9.17788C46.1709 8.26454 46.2665 7.94324 47.1084 7.58816C47.4091 7.46349 47.7169 7.36433 48.0099 7.26993C48.9099 6.97997 49.672 6.73443 49.672 5.93063C49.672 5.22043 48.9832 4.61182 48.1414 4.61182C47.4335 4.61182 46.725645.70595 43.1481 6.59048V11.9512C43.1481 13.2535 43.6264 13.8962 44.6595 13.8962C45.6924 13.8962 46.1709 13.2535 46.1709 11.9512V9.17788Z \ "/ \ u003e \ u003cpath d = \" M32.492 10.1419C32.492 14.648.942348 41.5985 12.6954 41.5985 10.1419V6.59049C41.5985 5.28821 41.1394 4.66232 40.1061 4.66232C39.0732 4.66232 38.5948 5.28821 38.5948 6.59049V9.60062C38.5948 10.8521 38.2696 11.5455 37.0451 11.5454.5C35.8 3520.49455C35.8 521 35.4954 9.60062V6.59049C35.4954 5.28821 35.0173 4.66232 34.0034 4.66232C32.9703 4.66232 32.492 5.28821 32.492 6.59049V10.1419Z \ "/ \ u003e \ u003cpath fill-rule = \" evenodd \ "clip-rule = \" evenodd \ "d = \ "M25.6622 17.6335C27.8049 17.6335 29.3739 16.9402 30.2537 15.6379C30.8468 14.7755 30.9615 13.5579 30.9615 11.9512V6.59049C30.9615 5.28821 30.4833 4.66231 29.4502 4.66231C28.9913 4.6620531 28.4502 4.66231C28.9913 4.662025C 289.15527 .1369 4.56087 21.0134 6.57349 21.0134 9.27932C21.0134 11.9852 23.003 13.913 25.3754 13.913C26.5612 13.913 27.4607 13.4902 28.1109 12.6616C28.1109 12.7229 28.1161 12.7799 28.121 12.8346C834.232.283 28.121 12.8346C2834.125.283 28.121 12.8346C2834.1256.28 15.2321 24.1352 14.9821 23.5661 14.7787C23.176 14.6393 22.8472 14.5218 22.5437 14.5218C21.7977 14.5218 21.2429 15.0123 21.2429 15.6887C21.2429 16.7375 22.9072 17.6335 25.6622 17.6317.10.99 732.943C 27.2119 7.09766 28.0918 7.94324 28.0918 9.27932C28.0918 10.6321 27.2311 11.5116 26.1024 11.5116C24.9737 11.5116 24.1317 10.6491 24.1317 9.27932Z \ "/ \ u003e \ u003cpath d = \" M16.802802.86.9512C358. 19.8079 13.2535 19.8079 11.9512V8.12928C19.8079 5.82936 18.4879 4.62866 16.4027 4.62866C15.1594 4.62866 14.279 4.98375 13.3609 5.88013C12.653 5.05154 11.6581 4.62866 10.3573 4.62866C9.34336 4.62866 4.62866 732948203 5.00066 5.28821 5.00066 6.59049V11.9512C5.00066 13.2535 5.47873 13.8962 6.51203 13.8962C7.54479 13.8962 8.0232 13.2535 8.0232 11.9512V8.90741C8.0232 7.58817 8.44431 6.91179 9.53458 6.91179C10.51093 6.91179 9.53458 6.91179C10.593V93 6.9411879 10.81179C10.593V3 8.941182 C13.4375 13.8962 13.9157 13.2535 13.9157 11.9512V8.90741C13.9157 7.58817 14.3365 6.91179 15.4269 6.91179C16.4027 6.91179 16.8045 7.58817 16.8045 8.94108V11.9512Z \ "/ \ u003e \ u003cpath d = \ "M3.31675 6.59049C3.316755.28821 2.83866 4.66232 1.82471 4.66232C0.791758 4.66232 0.313354 5.28821 0.313354 6.59049V11.9512C0.313354 13.2535 0.791758 13.8962 1.82471 13.8962C2.85798 13.8962 3.31675 13.2535 3.31675 11.9512V6.590491Ce \ "/" / .843612 0.400291 0 1.1159 0 1.98861C0 2.87869 0.822846 3.57676 1.87209 3.57676C2.90056 3.57676 3.7234 2.87869 3.7234 1.98861C3.7234 1.1159 2.90056 0.400291 1.87209 0.400291Z \ "fill = \" \ u003c \ u003eg "/ u003c / a \ u003e ", contentPolicyHtml: "Contribuciones de usuario con licencia bajo \ u003ca href = \" https: //stackoverflow.com/help/licensing \ "\ u003ecc by-sa \ u003c / a \ u003e \ u003ca href = \" https://stackoverflow.com / legal / content-policy \ "\ u003e (política de contenido) \ u003c / a \ u003e", allowUrls: verdadero }, onDemand: verdadero, discardSelector: ".discard-answer" , inmediatamenteShowMarkdownHelp: true, enableTables: true, enableSnippets: true }); } }); ¡Gracias por contribuir con una respuesta a Stack Overflow! Asegúrese de responder la pregunta. ¡Proporcione detalles y comparta su investigación! Pero evita ... Pedir ayuda, aclaraciones o responder a otras respuestas. Hacer declaraciones basadas en opiniones; respaldarlos con referencias o experiencia personal. Para obtener más información, consulte nuestros consejos sobre cómo escribir buenas respuestas. Borrador guardado Borrador descartado Regístrese o inicie sesión StackExchange.ready (function () { StackExchange.helpers.onClickDraftSave ('# login-link'); }); Regístrese con Google Regístrese usando Facebook Regístrese usando correo electrónico y contraseña Enviar Publicar como invitado Nombre Correo electrónico Requerido, pero nunca mostrado StackExchange.ready ( function () { StackExchange.openid.initPostLogin ('. New-post-login', 'https% 3a% 2f% 2fstackoverflow.com% 2fquestions% 2f20579188% 2ftestng-failing-most-tests-after-update% 23new-answer', 'question_page' ); } ); Publicar como invitado Nombre Correo electrónico Requerido, pero nunca mostrado Publica tu respuesta Descarte Al hacer clic en "Publicar su respuesta", acepta nuestros términos de servicio, política de privacidad y política de cookies. No es la respuesta que estás buscando? Lea otras preguntas en las etiquetas java maven selenium gradle testng